package com.ikkong.qy.core;

import com.ikkong.biz.model.WeixinUser;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

public class WeixinAuthInterceptor implements Interceptor {

	@Override
	public void intercept(Invocation inv) {
		Controller controller = inv.getController();
		if(controller instanceof WeixinBaseController){
			WeixinUser user = ((WeixinBaseController) controller).getUser();
			if(user == null){
				((WeixinBaseController) controller).renderNoUser();				
				return;
			}
			inv.invoke();
		}else{
			inv.invoke();			
		}
		
	}

}
